﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
    [Table(Name = "CourseGuideSubMenu")]
    public class CourseGuideSubMenuInfo : IDetach
    {
        public CourseGuideSubMenuInfo()
        {
            Detach();
        }
        #region Model
        private int _id;
        private int _menuid = 0;
        private string _name;
        private int _guidecontent = 0;
        private int _orderid = 0;

        private EntityRef<CourseGuideMenuInfo> _courseGuideMenuInfo;

        [System.Data.Linq.Mapping.Association(Storage = "_courseGuideMenuInfo", ThisKey = "MenuId", OtherKey = "Id", IsForeignKey = true)]
        [XmlIgnore]
        public CourseGuideMenuInfo CollegeInfo
        {
            get { return _courseGuideMenuInfo.Entity; }
            set { _courseGuideMenuInfo.Entity = value; }
        }

        private EntityRef<CommonContentInfo> _commonContentInfo;

        [System.Data.Linq.Mapping.Association(Storage = "_commonContentInfo", ThisKey = "ContentId", OtherKey = "Id", IsForeignKey = true)]
        [XmlIgnore]
        public CommonContentInfo CommonContentInfo
        {
            get { return _commonContentInfo.Entity; }
            set { _commonContentInfo.Entity = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int MenuId
        {
            set { _menuid = value; }
            get { return _menuid; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("菜单名称")]
        [Required(ErrorMessage = "必须填写")]
        public string Name
        {
            set { _name = value; }
            get { return _name; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int ContentId
        {
            set { _guidecontent = value; }
            get { return _guidecontent; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int OrderId
        {
            set { _orderid = value; }
            get { return _orderid; }
        }
        #endregion Model

        public void Detach()
        {
            this._courseGuideMenuInfo = default(EntityRef<CourseGuideMenuInfo>);
            this._commonContentInfo = default(EntityRef<CommonContentInfo>);
        }
    }
}
